﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SourceControlEssentials
{
    class Chichota : IStudent
    {
        public override int GetHashCode()
        {
            return 21;
        }

        public int Id()
        {
            return GetHashCode();
        }
        public string GetLastName()
        {
            return "Chichota";
        }

        public string GetFirstName()
        {
            return "Artem";
        }

        public int GetGroup()
        {
            return 318;
        }

        public string MethodName()
        {
            return "first non-repeated character";
        }
        public string ExecuteStrategy(string value)
        {
            char[] someArray = value.ToCharArray();

            int j = 0;
            for (int i = 0; i < someArray.Length; i++)
            {
                if (j == i)
                { i++; }
                if (someArray[j] == someArray[i])
                { j++; i = 0; }
                if (i == someArray.Length - 1)
                {
                    return someArray[j].ToString();
                }
            }
            return "String doesn't have first non-repeated character";
        }
    }
}
